package peer.rudp;

import peer.rudp.command.Command;

public class TunnelOutputStream {
	TunnelUDP tun;
	ConnectionUDP conn;
	TunnelOutputStream(ConnectionUDP conn,TunnelUDP tun){
		this.tun=tun;
		this.conn=conn;
	}
	
	public void write(byte[] data,int offset,int length) throws ConnectException {
		conn.send(tun, data, offset, length);
		tun.open=true;
		tun.realOpen=true;
	}
	
	public void writeCommand(Command command) throws ConnectException{
		write(command.getData(),0,command.getData().length);
	}
	
}
